#define DEBUG
#include <cstdio>
#include <cstring>

using namespace std;

typedef long long ll;

const int maxlen=1000000, maxn=2097152, g=3, mods=998244353;
const char charset[]="syfaknoi";

ll qpower(ll a, ll n) {
  if (!n) {
    return 1;
  }
  ll s=1;
  for (; n>1; n>>=1) {
    if (n%2) {
      s = s*a%mods;
    }
    a = a*a%mods;
  }
  return a*s%mods;
}

ll getW(int n) {
  return qpower(g, (mods-1)/n);
}

void initPos(int n, int pos[]) {
  int logn;
  for (logn=0; (1<<logn)<n; logn++);
  for (int i=0; i<n; i++) {
    pos[i] = (pos[i>>1]>>1)|((i&1)<<(logn-1));
  }
}

void ntt(ll *a, int n, int inv, int pos[]) {
  for (int i=0; i<n; i++) {
    if (i<pos[i]) {
      ll t;
      t = a[i], a[i] = a[pos[i]], a[pos[i]] = t;
    }
  }
  for (int nn=1; nn<n; nn*=2) {
    ll t = inv>0 ? getW(2*nn) : qpower(getW(2*nn), mods-2);
    for (int i=0; i<n; i+=2*nn) {
      ll w=1;
      for (int j=0; j<nn; j++) {
	ll x=a[i+j], y=a[i+nn+j]*w%mods;
	a[i+j] = (x+y)%mods, a[i+nn+j] = (x+mods-y)%mods;
	w = w*t%mods;
      }
    }
  }
}

int main() {
  freopen("string.in", "r", stdin);
  freopen("string.out", "w", stdout);

  static char s1[maxlen+2], s2[maxlen+2];
  int k, n, m;
  scanf("%d %s %s", &k, s1, s2);
  m = strlen(s1), n = strlen(s2);

  static ll f[maxn+1], g[maxn+1], h[maxn+1], ans[maxn+1];
  static int pos[maxn+1];
  initPos(maxn, pos);
  ll t=qpower(maxn, mods-2);
  for (int nowc=0; charset[nowc]; nowc++) {
    memset(f, 0, sizeof f);
    for (int i=0; s1[i]; i++) {
      f[i] = s1[i]==charset[nowc];
    }
    memset(g, 0, sizeof g);
    for (int i=0; s2[i]; i++) {
      g[n-i-1] = s2[i]==charset[nowc];
    }

    ntt(f, maxn, 1, pos);
    ntt(g, maxn, 1, pos);
    for (int i=0; i<maxn; i++) {
      h[i] = f[i]*g[i]%mods;
    }
    ntt(h, maxn, -1, pos);
    for (int i=0; i<maxn; i++) {
      h[i] = h[i]*t%mods;
    }

    for (int i=0; i<m; i++) {
      ans[i] += h[n+i-1];
    }
  }

  int cnt=0;
  for (int i=0; i<=m-n; i++) {
    cnt += ans[i]>=n-k;
  }
  printf("%d", cnt);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
